<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0,user-scalable=no">
	<link rel="stylesheet" href="__PUBLIC__/css/style_wx.css">
	<link rel="stylesheet" href="__PUBLIC__/css/style_ng.css">
	<script type="text/javascript" src="__PUBLIC__/js/jquery-1.11.3.min.js"></script>
	<script src="__PUBLIC__/js/base64en_de.js"></script>
	<script src="__PUBLIC__/js/common.js"></script>
	<script src="__PUBLIC__/js/layer.m/layer.m.js"></script>
</head>
<style>
	.bannerbaowei{
		height:150px
	}
	.center5585{
		background-color:#ffffff
	}
</style>
<html>
<body style="position:relative;margin:0 auto">

	<div id="middle_content">
		<{$contents}>
	</div>
	<include file="Common:item" />
	
	<include file="Common:success_bottom"/>
	<input type="hidden" id="select_item">
	<input type="hidden" id="select_item_b"><!--o--->
	<include file="Common:display_title"/>
</body>
</html>

<script>
	<?php if($judge_wx == 1):?>
		var length = $('img').length;
		//替换图片
		if(length){
			for(var a = 0;a< length;a++){
				var src  = $('img').eq(a).attr('data-src');
				var type = $('img').eq(a).attr('data-type');
			
				if(type == '' || type == 'undefined'){
					type = 'jpg';
				}
				
				if(src){
				//传递url
					$.ajax({
					   type: "POST",
					   url: "<{:U('Home/Article/file_picture')}>",
					   data: "url="+src+"&type="+type,
					   async:false,
					   success: function(msg){
						 $('img').eq(a).attr('src',msg.msg);
					   }
					});
				}
			}
		};
		var iflength = $('iframe').length;
		if(iflength){
			for(var a = 0;a< length;a++){
				var src = $('iframe').eq(a).attr('data-src');
				$('iframe').eq(a).attr('src',src);
			}
		}
	//绑定事件
	var children_dom = $('#js_content').children();
	for(var dom = 0;dom<children_dom.length;dom++){
		$(children_dom).eq(dom).attr('onclick','position(this)');
		$(children_dom).eq(dom).attr('data-position','ng_'+dom);
		$(children_dom).eq(dom).attr('id','ng_'+dom);
		//$(children_dom).eq(dom).addClass('length_count');
	};
	
	//找到微信标题
	var title = $('#activity-name').text();
	$('#new_title').val($.trim(title));
	
	<?php else:?>
	var dom = 0;
	$("#middle_content").find('div,p,img,h1,h2').each(function(){
		$(this).attr('onclick','');
	});
	
	$("iframe").each(function(){
		//$(this).attr('src','');
	});
		<?php if($judge_alert == '1'):?>
			layer.open({
				content:'网络原因,文章内容被劫走了'
			});
		<?php endif;?>
	<?php endif;?>
	
	
	
	//插入当前元素
	function insertion(obj){
		var tid = $(obj).attr('data-tid');
		$.ajax({
		   type: "POST",
		   url: "<{:U('Home/Article/gain_item_info')}>",
		   data: "id="+tid,
		   success: function(msg){
			 if(msg.status == '-1'){
				layer.open({
					content:msg.msg
				});
				return false;
			 }else{
				$('body,html').removeClass('scrool');
				var public_url = "<{:C('images_url')}>";
				var html  = group_type(msg,public_url);
				var value = $('#select_item').val();
				if(msg.data.button_type == '1'){
					$('#middle_content').append(html);
				}else{
					$('#'+value).after(html);
				}
				$('#dom').css('display','none');
				$(obj).parents('#page4').remove();
			 }
		   }
		});
	}
	
	//提交
	function success(){
		var content = $('#middle_content').html();
		var new_title = $('#new_title').val();
		$('#middle_content').find('.css_background').removeClass('css_background');
		if(new_title == ''){
			$('#banner').show();
			layer.open({
				content:'文章标题不能为空'
			});
			return false;
		}
		if(new_title != ''){
			title = new_title;
		}
		$.ajax({
			type: "POST",
			url: "<{:U('Home/Article/article_submit')}>",
			data: "content="+content+"&title="+title+"&type=1",
			success: function(msg){
				window.location.href = msg.url;
				if(msg.status == '1'){
					window.location.href = msg.url;
   	                /*layer.open({
   	                    content:msg.msg,
                        btn: ['确认'],
                        yes:function(){
                           window.location.href = msg.url;
                        }
                    });*/
				}else{
					layer.open({
						content:msg.msg
					});
				}
			}
		});
	}
	
//显示
function success_show(){
	if($('#new_title').val() != ''){
		$('#affirm').click();
		return false;
	}
	$('#banner').show();
	$('body,html').addClass('ovfHiden');
	$('#new_title').focus();
	return false;
}

//控制视频宽度
iframe_control();
video_adapt();
</script>


